<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<title></title>
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vant@2.5/lib/index.css">
		<link rel="stylesheet" href="../css/reset.css">
		<link rel="stylesheet" href="../css/global.css">
		<link rel="stylesheet" href="../css/addfriend.css">
		<script src="../js/flexble.js"></script>
		<script src="https://cdn.jsdelivr.net/npm/vue@2.6.11"></script>
		<script src="https://cdn.jsdelivr.net/npm/vant@2.5/lib/vant.min.js"></script>
		<script type="text/javascript" src="../sdk/webimSDK3.1.2.js"></script>
		<script type="text/javascript" src="../js/WebIMConfig.js"></script>
		<script type="text/javascript" src="../js/webconn.js"></script>
		<script type="text/javascript" src="../js/localstorage.js"></script>
		<script type="text/javascript" src="../utils/login.js"></script>
		<script type="text/javascript" src="../utils/dialog.js"></script>
	</head>
	<body>
		<div class="addfriendbox" id="bigbox">
			<div class="fixedtop">
				<div class="getBack">
					<van-button class="arrowbox" type="default" @click="back">
						<img src="../img/back.png">
					</van-button>
					<p class="fixedtoptit">添加好友</p>
					<!-- <van-button class="dingdan" type="default" @click="gourl('friendSet.html')">
						<img class="oicon1" src="../img/oicon1.png">
					</van-button> -->
				</div>
			</div>
			<div class="bottbox">
				<div class="searchBox">
					<img class="searb" src="../img/searb.png">
					<input type="text" v-model="value" placeholder="输入好友ID">
					<div class="clearseabox" v-if="clearicon" @click="clearinp">
						<img class="clearsea" src="../img/clearsea.png">
					</div>
				</div>
				<div class="textareabox">
					<textarea v-model="friendasksend" placeholder="备注">
						
					</textarea>
				</div>
				<van-button :disabled="!clearicon" type="primary" @click="addfunc">发送申请</van-button>
			</div>
		</div>
	</body>
</html>
<script type="text/javascript">
WebIM.message = WebIM.default.message;
var webvue = new Vue({
	el: '#bigbox',
	data() {
		return {
			value:'',
			clearicon:false,
			disabled:true,
			friendasksend:''
		}
	},
	watch:{
		value:{
			handler(){
				if(this.value){
					this.clearicon = true;
				}else{
					this.clearicon = false;
				}
			}
		}
	},
	mounted(){
		isfirst = 5;
		relogin()
	},
	methods:{
		back(){
			window.history.go(-1);
		},
		clearinp(){
			this.value = '';
		},
		addfunc(){
			var that = this;
			WebIM.conn.subscribe({
			    to: that.value,
			    message: that.friendasksend   
			});
			vant.Toast.success('发送成功');
		}
	}
})
</script>